﻿//using System;
//using System.Collections.Generic;
//using System.IO;
//using System.Security.Policy;
//using System.Text;
//using System.Web;
//using Dapper;
//using Microsoft.VisualBasic.CompilerServices;
//using MySql.Data.MySqlClient;
//using Newtonsoft.Json;
//using Senparc.CO2NET.Helpers;

//namespace ConsoleApp1
//{
//    class Program
//    {

//        public static string Kl_connectionString = "Server=127.0.0.1;Database=kl_activity;Uid=adkele;Pwd=liang123@usa.com;";

//        static void Main(string[] args)
//        {
//            Console.WriteLine("Hello World!");
//            //FillMusicDataTable();
//            FillRegisterList();
//        }

//        private static void FillMusicDataTable()
//        {
//            var path = @"C:\gitee\Repos\kl-activity\vs-server\ConsoleApp1\music.json";
//            var json = File.ReadAllText(path,Encoding.UTF8);

//            var list = JsonConvert.DeserializeObject<List<jsonMusicTag>>(json);
//            const string sqlTag = "insert into kl_activity_music_tag(id,tag_name) values(@tag_id,@tag_name)";
//            const string sqlMusic = "insert into kl_activity_music(id,tag_id,name,path) values(@id,@tag_id,@name,@path)";
//            using (var connection = new MySqlConnection(Kl_connectionString))
//            {
//                foreach (var listItem in list)
//                {
//                    connection.Execute(sqlTag, new {listItem.tag_id, listItem.tag_name});
//                    foreach (var item in listItem.bgm_list)
//                    {
//                        connection.Execute(sqlMusic, new {item.id, listItem.tag_id, item.name, item.path});
//                    }

//                }
//            }
         

//        }


//        private static void FillRegisterList()
//        {
//            var path = @"C:\gitee\Repos\kl-activity\vs-server\ConsoleApp1\registerList.json";
//            var json = File.ReadAllText(path, Encoding.UTF8);
//            var activity_id = "d10086e49c4ac005";

//            var list = JsonConvert.DeserializeObject<List<jsonRegister>>(json);

//            const string sql = "insert into kl_activity_register(activity_id,nickname,avatar,createdAt) values(@activity_id,@nickname,@avatar,@createdAt)";
//            using (var connection = new MySqlConnection(Kl_connectionString))
//            {
//                foreach (var item in list)
//                {
//                    var nickname = SerializerHelper.EncodeUnicode(item.nickname);
//                    connection.Execute(sql, new { activity_id, nickname, item.avatar, item.createdAt });
//                }
//            }
//        }
//    }
//}
